﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using control.Biz;

namespace control.Dal
{
    class DalLoaiSanPham
    {
        internal static List<control.Biz.BizLoaiSanPham> GetAll()
        {
            var loaisanphams = from lsp in DalCommon.TrangSucDB.LoaiSanPhams
                               select new BizLoaiSanPham(lsp.ID, lsp.MaLoai, lsp.TenLoai);
            return loaisanphams.ToList<BizLoaiSanPham>();
        }

        internal static BizLoaiSanPham GetLoaiSanPhamByID(int _IDLoai)
        {
            var loaisanphams = from lsp in DalCommon.TrangSucDB.LoaiSanPhams
                               where lsp.ID==_IDLoai
                               select new BizLoaiSanPham(lsp.ID, lsp.MaLoai, lsp.TenLoai);
            return loaisanphams.FirstOrDefault<BizLoaiSanPham>();
        }
    }
}
